package cn.lopr.im.android.utils.cos;

import com.tencent.qcloud.core.auth.BasicLifecycleCredentialProvider;
import com.tencent.qcloud.core.auth.QCloudLifecycleCredentials;
import com.tencent.qcloud.core.auth.SessionQCloudCredentials;
import com.tencent.qcloud.core.common.QCloudClientException;

public class MySessionCredentialProvider extends BasicLifecycleCredentialProvider {


    private String tmpSecretId;
    private String tmpSecretKey;
    private String sessionToken;
    private long expiredTime;
    private long startTime;
    private long expiration;

    private String bucket;
    private String region;

    public MySessionCredentialProvider() {
        super();
    }

    public MySessionCredentialProvider(String tmpSecretId, String tmpSecretKey, String sessionToken, long expiredTime, long startTime) {
        super();
        this.tmpSecretId = tmpSecretId;
        this.tmpSecretKey = tmpSecretKey;
        this.sessionToken = sessionToken;
        this.expiredTime = expiredTime;
        this.startTime = startTime;
    }

    @Override
    protected QCloudLifecycleCredentials fetchNewCredentials() throws QCloudClientException {
        return new SessionQCloudCredentials(tmpSecretId, tmpSecretKey,
                sessionToken, startTime, expiredTime);
    }

    public String getTmpSecretId() {
        return tmpSecretId;
    }

    public MySessionCredentialProvider setTmpSecretId(String tmpSecretId) {
        this.tmpSecretId = tmpSecretId;
        return this;
    }

    public String getTmpSecretKey() {
        return tmpSecretKey;
    }

    public MySessionCredentialProvider setTmpSecretKey(String tmpSecretKey) {
        this.tmpSecretKey = tmpSecretKey;
        return this;
    }

    public String getSessionToken() {
        return sessionToken;
    }

    public MySessionCredentialProvider setSessionToken(String sessionToken) {
        this.sessionToken = sessionToken;
        return this;
    }

    public long getExpiredTime() {
        return expiredTime;
    }

    public MySessionCredentialProvider setExpiredTime(long expiredTime) {
        this.expiredTime = expiredTime;
        return this;
    }

    public long getStartTime() {
        return startTime;
    }

    public MySessionCredentialProvider setStartTime(long startTime) {
        this.startTime = startTime;
        return this;
    }

    public String getBucket() {
        return bucket;
    }

    public MySessionCredentialProvider setBucket(String bucket) {
        this.bucket = bucket;
        return this;
    }

    public String getRegion() {
        return region;
    }

    public MySessionCredentialProvider setRegion(String region) {
        this.region = region;
        return this;
    }
}